'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;

  // 上传
  router.post('/v1/upload/file', controller.upload.file);

  // 登录

  router.post('/v1/user/login', controller.user.login);
  router.post('/v1/user/register', controller.user.create);

  // banner
  router.get('/v1/banner/list', controller.banner.allList);
  router.resources('banner', '/v1/banner', controller.banner);
  // 分类
  router.get('/v1/category/list', controller.category.allList);
  router.resources('category', '/v1/category', controller.category);
  // 素材
  router.get('/v1/material/list', controller.material.allList);
  router.resources('material', '/v1/material', controller.material);
  // news
  router.get('/v1/news/list', controller.news.allList);
  router.resources('news', '/v1/news', controller.news);
  // 会员
  router.get('/v1/user/list', controller.user.allList);
  router.resources('user', '/v1/user', controller.user);
  // 产品介绍
  router.get('/v1/productDesc/list', controller.productDesc.allList);
  router.resources('productDesc', '/v1/productDesc', controller.productDesc);
  // 发布内容
  router.get('/v1/publish/list', controller.publish.allList);
  router.resources('publish', '/v1/publish', controller.publish);
  // content
  router.get('/v1/content/list', controller.content.allList);
  router.resources('content', '/v1/content', controller.content);
  // comment
  router.get('/v1/comment/list', controller.comment.allList);
  router.resources('comment', '/v1/comment', controller.comment);
  // like
  router.get('/v1/like/list', controller.like.allList);
  router.resources('like', '/v1/like', controller.like);
  // chat
    router.get('/v1/chat/list', controller.chat.allList);
    router.resources('chat', '/v1/chat', controller.chat);
};
